PROJECT(minizip C)

SET(TARGET_LIB minizip)


SET(MINIZIP_PUBLIC_HEADERS
  ${MINIZIP_SOURCE_DIR}/zip.h
)

SET(MINIZIP_PRIVATE_HEADERS
  ${MINIZIP_SOURCE_DIR}/crypt.h
  ${MINIZIP_SOURCE_DIR}/ioapi.h
  ${MINIZIP_SOURCE_DIR}/iowin32.h
)

SET(MINIZIP_SRCS
  ${MINIZIP_SOURCE_DIR}/iowin32.c
  ${MINIZIP_SOURCE_DIR}/minizip.c
  ${MINIZIP_SOURCE_DIR}/zip.c
)

# Dependent include files
INCLUDE_DIRECTORIES(${MINIZIP_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES("${ZLIB_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/zlib")

IF(MSVC)
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
  SET(CMAKE_DEBUG_POSTFIX "d")
ENDIF(MSVC)

ADD_LIBRARY(${TARGET_LIB} STATIC ${MINIZIP_SRCS} ${MINIZIP_PRIVATE_HEADERS} ${MINIZIP_PUBLIC_HEADERS})

# Runtime equals DLL-files
# Archive equals static libraries
# Library equals module libraries
IF(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
  INSTALL(TARGETS ${TARGET_LIB}
    RUNTIME DESTINATION ${EXECUTABLE_OUTPUT_PATH}
    LIBRARY DESTINATION ${LIBRARY_OUTPUT_PATH}
    ARCHIVE DESTINATION ${ARCHIVE_OUTPUT_PATH})
ENDIF()
IF(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
  INSTALL(FILES ${MINIZIP_PUBLIC_HEADERS} DESTINATION ${INCLUDE_OUTPUT_PATH})
ENDIF()
